package com.xaaef.grpc.client.util;


@lombok.Getter
@lombok.Setter
public class GrpcResponseWrapper<T> implements java.io.Serializable {

    private io.grpc.Status status;

    private T data;

    public String getMessage() {
        return this.status.getDescription();
    }

    public boolean isOk() {
        return this.status.isOk();
    }

    private GrpcResponseWrapper() {
    }

    public static <T> GrpcResponseWrapper<T> result(io.grpc.Status status, T data) {
        var result = new GrpcResponseWrapper<T>();
        result.status = status;
        result.data = data;
        return result;
    }

}
